﻿using System.Text;

namespace eLongLoginTest.Air_Search_Helper
{
    class FlightSearchRequestBody : IRequestBody
    {
        public string vfrom {get;set;}
        public string vto { get; set; }
        public string vdate { get; set; }
        public string vtime { get; set; }
        public string vaircorp { get; set; }
        public string vcityissued { get; set; }

        /// <summary>
        /// 无参数的构造函
        /// </summary>
        public FlightSearchRequestBody() { 
        
        }

        /// <summary>
        /// 实现通用的接口方法
        /// </summary>
        /// <returns></returns>
        public string ToXml() {

            StringBuilder sb = new StringBuilder();
            sb.Append("<flightsearch>");
            sb.Append("<from>" + vfrom + "</from>");
            sb.Append("<to>" + vto + "</to>");
            sb.Append("<date>" + vdate + "</date>");
            sb.Append("<time>" + vtime + "</time>");
            sb.Append("<aircorp>" + vaircorp + "</aircorp>");
            sb.Append("<cityissued>" + vcityissued + "</cityissued>");
            sb.Append("</flightsearch>");

            return sb.ToString();
                   
        }

        public FlightSearchRequestBody from(string _from)
        {
            this.vfrom = _from;
            return this;
        }

        public  FlightSearchRequestBody to(string _to)
        {
            this.vto = _to;
            return this;
        }

        public FlightSearchRequestBody date(string _vdate)
        {
            this.vdate = _vdate;
            return this;
        }

        public FlightSearchRequestBody time(string _vtime)
        {
            this.vtime = _vtime;
            return this;
        }

        public FlightSearchRequestBody aircorp(string _vaircorp)
        {
            this.vaircorp = _vaircorp;
            return this;
        }

        public FlightSearchRequestBody cityissued(string _vcityissued)
        {
            this.vcityissued = _vcityissued;
            return this;
        }

    }
}
